﻿namespace LimitatorInterfaces
{
    public class LimitEntity //: ILimitEntity
    {
        public string ClientCode { get;  set; }
        public decimal Value { get;  set; }
        public bool IsMoney { get;  set; }
        public string ActiveCode { get;  set; }
        public string TradeSystem { get;  set; }
        public decimal Leverage { get;  set; }
        public decimal WaPrice { get;  set; }

        public override string ToString()
        {
            return string.Format("ClientCode:{0}, Value:{1}, IsMoney:{2},ActiveCode:{3},TradeSystem:{4},Leverage:{5},WaPrice{6}", ClientCode, Value, IsMoney, ActiveCode, TradeSystem, Leverage, WaPrice);
        }

        public static LimitEntity Create(string clientCode, decimal value, string activeCode,
            bool isMoney, string tradeSystem, decimal leverage = 1, decimal waPrice = 0)
        {
            return new LimitEntity
                {
                    ClientCode = clientCode,
                    Value = value,
                    ActiveCode = activeCode,
                    IsMoney = isMoney,
                    TradeSystem = tradeSystem,
                    Leverage = leverage,
                    WaPrice = waPrice
                };
        }

        public LimitEntity()
        {
        }

        public LimitEntity(string clientCode, decimal value, string activeCode,
                           bool isMoney, string tradeSystem, decimal leverage = 1, decimal waPrice = 0)
        {
            ClientCode = clientCode;
            Value = value;
            ActiveCode = activeCode;
            IsMoney = isMoney;
            TradeSystem = tradeSystem;
            Leverage = leverage;
            WaPrice = waPrice;
        }

        public LimitEntity Clone()
        {
            return Create(ClientCode, Value, ActiveCode, IsMoney, TradeSystem, Leverage, WaPrice);
        }

        public void SetValue(decimal val)
        {
            Value = val;
        }
    }
}